import pyfiglet as figlet # 花体库
import tkinter as tk # GUI库
import func # 自定义函数库
import os

fish = figlet.figlet_format ("Fish's" , font = 'train')
print (fish)
title = figlet.figlet_format ("Dictionary" , font = 'train')
print (title)

# window = tk.Tk()

# window.title ("Fish's Dictionary")
# window.geometry (newGeometry = "500x300+500+500")
# window.resizable (width = False , height = False)

# title1 = tk.Label(master = window , text = fish)
# title2 = tk.Label(master = window , text = title)
# title1.pack (pady = 15)
# title2.pack (pady = 15)

# window.mainloop ()

while (True) :
    # 先写一个菜单
    while (True):
        func.menu()
        try:
            choose = int (input ("请选择: "))
            if (choose not in [0,1,2,3]):
                raise ValueError
            elif (choose == 0):
                break
            else :
                break
        except ValueError:
            os.system ('cls')
            print ("输入有误，请重新输入！")
            print ()
    if (choose == 0):
        bye = figlet.figlet_format ("Bye" , font = 'train')
        os.system ('cls')
        print (bye)
        print (bye)
        print ()
        break
    
    # 查询字典
    elif (choose == 1):
        choose = func.serach()
        print ()
        
    # 添加汉字
    if (choose == 2):
        choose = func.add()
        
    # 移除汉字
    elif (choose == 3):
        choose = func.remove()